package at.ac.tuwien.swa.sparrow.server.component

import ac.at.tuwien.infosys.swa.audio.Fingerprint
import at.ac.tuwien.swa.sparrow._
import at.ac.tuwien.swa.sparrow.common.Ticket
import org.springframework.stereotype.Component
import scala.collection.mutable.ListBuffer

@Component
class TicketProvider(var hopCount: Int) {

	def this() = this(HOP_COUNT)

	def create(userId: Long, fp: Fingerprint = null, hopCount: Int = -1) =
		new Ticket(userId, fp, ListBuffer(), if (hopCount >= 0) hopCount else this.hopCount)
}
